<template>
	<view>
		<block v-for="(item,index) in livestockInfo" :key="index">
			<view class="list" >
			<view  @tap="ifShow(index)" class="cu-form-group">
				<view class="title">编号</view>
				<input  disabled="false"  :placeholder="item.livestockTagNumber" name="input"></input>
				<text @click="toData(item)" style="color: #0081FF; margin-right: 10rpx;">编辑</text>
				<text v-if="ind === index?true:false" class="icon iconfont">&#xe601;</text>
				<text v-else class="icon iconfont">&#xe600;</text>
			</view>
			<template  v-if="ind === index?true:false">
			<view class="cu-form-group">
				<view class="title">出生日期</view>
				<input  disabled="false"  :placeholder="item.creatDateTime" name="input"></input>
				</view>
				<view class="cu-form-group">
				<view class="title">出生地</view>
				<input  disabled="false"  :placeholder="item.livestockPlace" name="input"></input>
				</view>
				<view class="cu-form-group">
				<view class="title">出生种类</view>
				<input  disabled="false"  :placeholder="item.type_name" name="input"></input>
				</view>
				<view class="cu-form-group">
				<view class="title">性别</view>
				<input  disabled="false"  :placeholder="item.livestockGender" name="input"></input>
				</view>
				<view class="cu-form-group">
				<view class="title">体重</view>
				<input  disabled="false"  :placeholder="item.livestockWeight" name="input">KG</input>
				</view>
				<view class="cu-form-group">
				<view class="title">体温</view>
				<input  disabled="false"  placeholder="0" name="input">℃</input>
				</view>
				<view class="cu-form-group">
				<view class="title">检疫编号</view>
				<input  disabled="false"  :placeholder="item.livestockNumber" name="input"></input>
				</view>
				<view class="cu-form-group">
				<view class="title">所在猪栏</view>
				<input  disabled="false"  :placeholder="item.pigsty_number" name="input"></input>
				</view>
				<view class="cu-form-group">
				<view class="title">批次号</view>
				<input  disabled="false"  :placeholder="item.batch_number" name="input"></input>
				</view>
				</template>
			</view>
		</block>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
			livestockInfo:"",
			ind:'',
			}
		},
		onReady() {
			this.getLivestockInfo();
		},
		methods: {
			//是否显示
			ifShow(index){
				this.ind = this.ind === index ? !index : index;
			},
			toData(item){
				console.log(item)
				uni.navigateTo({
					url:"./livestock-updata"
				})
				uni.$emit('liveUpDate',item)
			},
			getLivestockInfo(){
				
				uni.request({
					url: this.confige.webUrl + "/livestock/findLivestockList",
					data: {
						farmId:this.User.userInfo.farm_id,
						limits:10,
						pages:1
					},
					header: {
						'X-Token': this.User.token
					}
				}).then((data)=>{
					 var [error, res]  = data;
					console.log(res)
					this.livestockInfo = res.data.result[0].list;
					console.log(this.livestockInfo)
				})
			}
			
		}
	}
</script>

<style lang="less">
   @import "../../../common/global.less";
   @import "../../../common/main.css";
   @import "../../../common/iconReg.css" ;
   .list{
	   margin: 0rpx 0rpx 15rpx 0rpx;
   }
</style>
